//
//  JsonParse.m
//  投融保
//
//  Created by 523 on 13-12-28.
//  Copyright (c) 2013年 木叶科技. All rights reserved.
//

#import "JsonParse.h"
#import "investPerson.h"
#import "proList.h"
#import "huaRuRecord.h"
#import "huaChuRecord.h"
#import "touZiRecord.h"
@implementation JsonParse

- (NSMutableArray *)parseLogin:(NSDictionary *)jsonDic
{
    NSMutableArray *arrUserLogin=[NSMutableArray new];
//    for (NSMutableArray *item in jsonDic) {
//        UserLogin *user=[UserLogin new];
////        user.code=[item valueForKey:@"code"];
//        user.message=[jsonDic valueForKey:@"status"];
//        user.code=[jsonDic valueForKey:@"code"];
//        user.message=[jsonDic valueForKey:@"appKey"];
//        [arrUserLogin addObject:user];
//    }
    return arrUserLogin;
}
//银行卡解析
-(NSMutableArray *)bankCardPares:(NSDictionary *)jsonDic{
    NSArray *bankInfoArr= [jsonDic objectForKey:@"bankInfos"];
    NSMutableArray *bankCardArr = [NSMutableArray new];
    for (NSDictionary *lBankCard in bankInfoArr) {
        ownBankCard *myBankCard = [ownBankCard new];
        myBankCard.logoUrl = [lBankCard valueForKey:@"logoUrl"];
        myBankCard.bankName = [lBankCard valueForKey:@"bankName"];
        myBankCard.bankCode = [lBankCard valueForKey:@"bankCode"];
        [bankCardArr addObject:myBankCard];
    }

    return bankCardArr;
}
//投资人解析
-(NSMutableArray *)inverstPersonPares:(NSDictionary *)jsonDic{
    NSArray *inverstInfosArray = [jsonDic objectForKey:@"infos"];
    NSMutableArray *inverstPersonArray = [NSMutableArray new];
    for (NSDictionary *linverstPerson in inverstInfosArray) {
        investPerson *inverstPer = [investPerson new];
        inverstPer.userName = [linverstPerson valueForKey:@"userName"];
        inverstPer.createTime = [linverstPerson valueForKey:@"createTime"];
        inverstPer.memoNo = [linverstPerson valueForKey:@"memoNo"];
        inverstPer.realName = [linverstPerson valueForKey:@"realName"];
        inverstPer.userState = [linverstPerson valueForKey:@"state"];
        inverstPer.userBaseId = [linverstPerson valueForKey:@"userBaseId"];
        inverstPer.distributionQuota=[linverstPerson valueForKey:@"distributionQuota"];
        [inverstPersonArray addObject:inverstPer];
    }
    

    return inverstPersonArray;
}
//项目列表解析
-(NSMutableArray *)proListPerse:(NSDictionary *)jsonDic{

    NSMutableArray *proListArray = [NSMutableArray new];
    NSArray *proInfoArr = [NSArray new];
    proInfoArr= [jsonDic objectForKey:@"infos"];
   for (NSDictionary *linverstPerson in proInfoArr) {
        proList *pro = [proList new];
        pro.tradeAnnualRate = [linverstPerson valueForKey:@"tradeAnnualRate"];
        pro.tradeName = [linverstPerson valueForKey:@"tradeName"];
        pro.persontage = [linverstPerson valueForKey:@"persontage"];
        pro.timePeriod = [linverstPerson valueForKey:@"timePeriod"];
        pro.message = [linverstPerson valueForKey:@"message"];
        pro.investStartTime = [linverstPerson valueForKey:@"investStartTime"];
        pro.investCompleteTime = [linverstPerson valueForKey:@"investCompleteTime"];
        pro.investCompleteTime = [linverstPerson valueForKey:@"investCompleteTime"];
        pro.effectiveDate = [linverstPerson valueForKey:@"effectiveDate"];
        pro.code = [linverstPerson valueForKey:@"code"];
        pro.deadline = [linverstPerson valueForKey:@"deadline"];
        pro.guaranteeName = [linverstPerson valueForKey:@"guaranteeName"];
        pro.tradeAmount = [linverstPerson valueForKey:@"tradeAmount"];
        pro.status = [linverstPerson valueForKey:@"status"];
        pro.requiredAmount = [linverstPerson valueForKey:@"requiredAmount"];
        pro.tradeStatus = [linverstPerson valueForKey:@"tradeStatus"];
        pro.demandId = [linverstPerson valueForKey:@"demandId"];
        pro.tradeId = [linverstPerson valueForKey:@"tradeId"];
        pro.tradeLoanedAmount = [linverstPerson valueForKey:@"tradeLoanedAmount"];
        [proListArray addObject:pro];
    }
    
    
    return proListArray;

}

//佣金管理解析
- (NSMutableArray *)investmentPares:(NSDictionary *)jsonDic
{
    return [NSMutableArray new];
}
//投资记录解析
-(NSMutableArray *)touZiRecordPares:(NSDictionary *)jsonDic{
    NSMutableArray *touZiReordArr = [NSMutableArray new];
    NSArray *infoArr= [jsonDic objectForKey:@"infos"];
    for (NSDictionary *lTouZi in infoArr) {
        touZiRecord *touZi = [touZiRecord new];
    
        [touZiReordArr addObject:touZi];
    }

    return touZiReordArr;
}
//划入记录解析
-(NSMutableArray *)huaRuRecordPares:(NSArray *)jsonArr{
    NSMutableArray *huaRuReordArr = [NSMutableArray new];
    for (NSDictionary *lHuaRu in jsonArr) {
        huaRuRecord *huaRu = [huaRuRecord new];
        huaRu.amount = [lHuaRu valueForKey:@"amount"];
        NSLog(@"%@",[lHuaRu valueForKey:@"amount"]);
        huaRu.outBizNo = [lHuaRu valueForKey:@"outBizNo"];
        huaRu.apiAccess = [lHuaRu valueForKey:@"apiAccess"];
        huaRu.bankName = [lHuaRu valueForKey:@"bankName"];
        huaRu.status = [lHuaRu valueForKey:@"status"];
        huaRu.payTime = [NSString stringWithFormat:@"%@",[lHuaRu valueForKey:@"payTime"]];
        [huaRuReordArr addObject:huaRu];
    }
    
    return huaRuReordArr;
}
//划出记录解析
-(NSMutableArray *)huaChuRecordPares:(NSDictionary *)jsonDic{
    NSMutableArray *huaChuReordArr = [NSMutableArray new];
    NSArray *infoArr = [NSArray new];
    infoArr= [jsonDic objectForKey:@"infos"];
    for (NSDictionary *lHuaChu in infoArr) {
        huaChuRecord *huaChu = [huaChuRecord new];
        
        [huaChuReordArr addObject:huaChu];
    }
    
    return huaChuReordArr;
}

@end
